import { IPSAppView } from '../../app/view/ipsapp-view';
import { IPSDEFormIFrame } from './ipsdeform-iframe';
import { PSDEFormDetailImpl } from './psdeform-detail-impl';

export class PSDEFormIFrameImpl extends PSDEFormDetailImpl implements IPSDEFormIFrame {
  get iFrameUrl(): string {
    return this.M.iFrameUrl;
  }

  protected linkpsappview: IPSAppView | null = null;

  getLinkPSAppView(): IPSAppView | null {
    if (this.linkpsappview != null) return this.linkpsappview;
    const value = this.M.getLinkPSAppView;
    if (value == null) {
      return null;
    }
    this.linkpsappview = this.getPSModel4('app.view.IPSAppView', value, 'getLinkPSAppView') as IPSAppView;
    return this.linkpsappview;
  }

  get linkPSAppView(): IPSAppView | null {
    return this.getLinkPSAppView();
  }

  getLinkPSAppViewMust(): IPSAppView {
    const value = this.getLinkPSAppView();
    if (value == null) {
      throw new Error('未指定链接应用视图');
    }
    return value;
  }

  get refreshItems(): string {
    return this.M.refreshItems;
  }

  get cls(): string {
    return 'PSDEFormIFrameImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'control.form.IPSDEFormIFrame') return true;
    return super.instanceof(cls);
  }
}
